home *** CD-ROM | disk | FTP | other *** search
/ TestDrive Windows 1993 Fall / TestDrive Windows 1993 Fall.iso / dbase / samples / mrowcol.prg < prev    next >
Encoding:
Text File  |  1993-03-09  |  1.6 KB  |  54 lines

  1. PROCEDURE MRowCol
  2. *--------------------------------------------------------------------
  3. * DESCRIPTION
  4. *   MRowCol displays how to use MROW() and MCOL() for determining
  5. *   the location of the mouse cursor.  MRowCol will display the
  6. *   coordinates for any mouse clicks.  To exit, click on the colored
  7. *   Quit button or press Q.
  8. *--------------------------------------------------------------------
  9.  
  10.   SET TALK OFF
  11.   SET ESCAPE OFF
  12.   SET TRAP OFF
  13.  
  14.   IF ISMOUSE()
  15.     *-- Set up the display window
  16.     SET COLOR TO w+/b
  17.     CLEAR
  18.     @ 3, 26 TO 8, 54 DOUBLE
  19.     @ 4, 29 SAY "Last mouse click at:"
  20.     @ 5, 30 SAY "MRow(): "
  21.     @ 6, 30 SAY "MCol(): "
  22.     @ 10, 36 SAY "  Quit  " COLOR w+/g
  23.     lQuit = .F.
  24.     DO WHILE .NOT. lQuit
  25.       SET CONSOLE OFF
  26.       SET CURSOR OFF
  27.       WAIT                              && Wait for a mouse click
  28.       SET CURSOR ON
  29.       SET CONSOLE ON
  30.       nMRow = MRow()                    && Capture the mouse row and
  31.       nMCol = MCol()                    && column as soon as possible
  32.       nLKey = LASTKEY()
  33.       IF nLKey = 81 .OR. nLKey = 113    && If 'Q' or 'q'
  34.         lQuit = .T.
  35.       ELSE
  36.         *-- Check for a click on the Quit button
  37.         IF nMRow = 10 .AND. nMCol >= 36 .AND. nMCol <= 43
  38.           lQuit = .T.                   && If so, signal an exit
  39.         ENDIF
  40.       ENDIF
  41.       *-- Display the row and column of the click
  42.       @ 5, 38 SAY STR( nMRow, 2 )
  43.       @ 6, 38 SAY STR( nMCol, 2 )
  44.     ENDDO
  45.   ENDIF
  46.   SET TALK ON
  47.   SET ESCAPE ON
  48.   SET TRAP ON
  49.   CLEAR
  50.  
  51. RETURN
  52. *-- EOP: MRowCol
  53.  
  54.